package com.ppgames.gm.gmsystem.util;

import java.util.Random;

public class Util {


    static Random random = new Random();

    public static int getRandom(int scale) {
        return (random.nextInt() << 1 >>> 1) % scale;
    }

    public static int getRandom(int resultFrom, int resultTo) {
        if (resultFrom > resultTo) {
            resultFrom = resultFrom + resultTo;
            resultTo = resultFrom - resultTo;
            resultFrom = resultFrom - resultTo;
        }
        return resultFrom + getRandom(resultTo - resultFrom + 1);
    }


    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(getRandom(1001, 1042));
        }

        int card = 0;
        card = Util.getRandom(Const.CARD_SS_MIN, Const.CARD_SS_MAX);
        while (Const.card_can_not_lottery.contains(card) || card == 1032) {
            card = Util.getRandom(Const.CARD_SS_MIN, Const.CARD_SS_MAX);
        }
        System.out.println("end");
        System.out.println(card);
    }


}
